#include<stdio.h>
#include<conio.h>
#include<graphics.h>

int main()
{
	initgraph(1200, 800);//定义窗口大小
	setbkcolor(RGB(169, 169, 169));//定义背景颜色为灰色
	cleardevice();//使用灰色填充背景

	double Pi = 3.1415926;

	int centerX = 200;//定义扇形所在圆圆心X坐标
	int centerY = 200;//定义扇形所在圆圆心Y坐标
	int radius = 200;//定义扇形所在圆半径



	int i, n;
	double offset;
	double totaloffset = 0;
	while (1)
	{
		for (centerX = 200;centerX <= 1000;centerX = centerX + 400)
		{
			for (centerY = 200;centerY <= 600;centerY = centerY + 400)
			{
				for (radius = 200;radius > 0;radius = radius - 50)
				{
					int left = centerX - radius;//定义扇形所在外接圆左侧坐标
					int right = centerX + radius;//定义扇形所在外接圆右侧坐标
					int top = centerY + radius;//定义扇形所在外接圆顶部坐标
					int bottom = centerY - radius;//定义扇形所在外接圆底部坐标

					float h;
					h = rand() % 180;
					COLORREF colour1 = HSVtoRGB(h, 0.9, 0.8);
					COLORREF colour2 = HSVtoRGB(h+180, 0.9, 0.8);


					for (i = 0;i <= 19;i++)
					{
						offset = 6 * Pi / 60 * i + totaloffset;
						setfillcolor(colour1);
						solidpie(left, top, right, bottom, offset, offset + 2 * Pi / 60);
						setfillcolor(RGB(255, 255, 255));
						solidpie(left, top, right, bottom, offset + 2 * Pi / 60, offset + 3 * Pi / 60);
						setfillcolor(colour2);
						solidpie(left, top, right, bottom, offset + 3 * Pi / 60, offset + 5 * Pi / 60);
						setfillcolor(RGB(0, 0, 0));
						solidpie(left, top, right, bottom, offset + 5 * Pi / 60, offset + 6 * Pi / 60);
					}
					totaloffset = totaloffset + 3 * Pi / 60;
				}
			}
		}
		_getch();//等待用户输入
	}	
}